package com.test4;

import java.io.*;
import java.util.LinkedList;
import java.util.List;

public class ReadText {

    /**
     * @param filepath 路劲+文件名
     * */
    public static List<String> read(String filepath){
        List<String> names = new LinkedList<>();
        File file = new File(filepath);
        StringBuffer bu = new StringBuffer();
        try(BufferedReader br = new BufferedReader(new InputStreamReader(
                new FileInputStream(file), "UTF-8"));){
            String lineTxt;
            while ((lineTxt = br.readLine()) != null) {
                names.add(lineTxt);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return names;
    }


}
